package com.qf.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.qf.mapper.DtsCategoryMapper;
import com.qf.service.CategoryService;
import com.qf.vo.CatVo;
import com.qf.vo.CategorySellAmts;
import com.qf.vo.CategorySellVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Service
public class CategoryServiceImpl implements CategoryService {
    @Autowired
    private DtsCategoryMapper dtsCategoryMapper;
    @Override
    public List<CategorySellAmts> findCategoryAndTotal() {
        List<CategorySellAmts> categorySellAmtsList = dtsCategoryMapper.findCategoryAndTotal();



        return categorySellAmtsList;
    }

    @Override
    public List<CatVo> findAll() {
        List<CatVo> catVoList=dtsCategoryMapper.findParent();
        for (CatVo catVo : catVoList) {
            catVo.setChildren(dtsCategoryMapper.findChildren(catVo.getValue()));
        }

        return catVoList;
    }
}
